<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>文章列表</title>
<link href="<%=request.getContextPath() %>/resources/img/tea.png" rel="icon">
    <!-- Bootstrap -->
    <link href="<%=request.getContextPath() %>/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="<%=request.getContextPath() %>/resources/css/datepicker.css" rel="stylesheet">
    <link href="<%=request.getContextPath() %>/resources/layui/css/layui.css" rel="stylesheet">
    <link href="<%=request.getContextPath() %>/resources/css/newmessagelist.css" rel="stylesheet">
    <script src="<%=request.getContextPath() %>/resources/jquery/jquery-1.11.3.min.js"></script>
    <script src="<%=request.getContextPath() %>/resources/bootstrap/js/bootstrap.min.js"></script>
    <script src="<%=request.getContextPath() %>/resources/layer/layer.js"></script>	
    <script src="<%=request.getContextPath() %>/resources/layui/layui.js"></script>		
    <script src="<%=request.getContextPath() %>/resources/js/numberChina.js"></script>	
 	<script src="<%=request.getContextPath() %>/resources/js/date-time/bootstrap-datepicker.js"></script>
    <script  src="<%=request.getContextPath() %>/resources/js/newmessagelist.js"></script>
	<script src="<%=request.getContextPath() %>/resources/jquery/adddate.js"></script>
	<script>
	$(function(){
		var checkAuthor = '${checkAuthor}';
		if(checkAuthor !=''){
			$("#queryauthor").val(checkAuthor);
		}
		var checkTitle = '${checkTitle}';
		if(checkAuthor !=''){
			$("#querytitle").val(checkTitle);
		}
		var checkStartTime = '${checkStartTime}';
		if(checkStartTime !=''){
			$("#startTime").val(checkStartTime);
		}
		var checkEndTime = '${checkEndTime}';
		if(checkEndTime !=''){
			$("#endTime").val(checkEndTime);
		}
	})
		
	</script>
</head>
<body class="hold-transition skin-blue sidebar-mini"  style="background-image: linear-gradient(to top, #fff,#30A12B); height: 1965px;">
<input id="usersequence" type="text" value='<%=session.getAttribute("usersequence") %>' hidden>

	<jsp:include page="/WEB-INF/jsp/menu.jsp" />

		
	<div class="container col-sm-12">
	
	<div class="form row">
		<form class="form-horizontal" role="form">
			  <div class="form-group col-sm-12">
				    <label class="control-label col-sm-1">作者</label>
		            <input type="text"  class="form-control col-sm-1" placeholder="AUTHOR" name="queryauthor" id="queryauthor" style="width:250px">
				   	<label class="control-label col-sm-1">标题</label>
		          	<input type="text"  class="form-control col-sm-1" placeholder="TITLE" name="querytitle" id="querytitle" style="width:250px">
				    <label class="control-label col-sm-1">开始时间</label>
	                <input  type="text" class="form-control col-sm-1" id="startTime" placeholder="START_TIME" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss')" style="width:250px"/>
				   	<label class="control-label col-sm-1">结束时间</label>
	              	<input  type="text" class="form-control col-sm-1" id="endTime" placeholder="END_TIME" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss')" style="width:250px"/>
				  	<input type="button" value="查询" id="queryBtn" class="btn btn-default col-sm-1" style="width:100px">
			  </div>
   		</form>	    	
		  
		  	
	
			
			
				<div class="row">
				<div class="col-sm-2"></div>
		  		<div class="col-sm-8">
		  		
		  		 <div class="blog" >
		  		 
		  		 
		  		 	<c:choose>
			<c:when test="${not empty list }">
				<c:forEach items="${list }" var="lis" varStatus="vs">
                <div target="_blank" class="blog_info">
                    <div class="card">
                      <a href="/TeaCulture/newmessage?newmessage_id=${lis.newmessage_id }"> <h3>${lis.newmessage_title }</h3></a>
                        <c:choose>
							<c:when test="${lis.messageType==1 }">
	                        <p><span class="label label label-default">生活</span></p>
	                        </c:when>
                        	<c:when test="${lis.messageType==2 }">
	                        <p><span class="label label label-default">心得</span></p>
	                        </c:when>
	                        <c:when test="${lis.messageType==3 }">
	                        <p><span class="label label label-default">交流</span></p>
	                        </c:when>
	                        <c:when test="${lis.messageType==4 }">
	                        <p><span class="label label label-default">详情</span></p>
	                        </c:when>
	                        <c:when test="${lis.messageType==5 }">
	                        <p><span class="label label label-default">其他</span></p>
	                        </c:when>
                        </c:choose>
                        <div class="blog_bom text-right">
                            <span class="pull-left">
                            	<span>${lis.newmessage_create_dt }</span>
                            </span>
                            <span class="">
                            	<span>阅读</span>
                            	<span class="blog_bom_word">${lis.pageViewCount }</span>
                            </span>
                            <span class="">
                            	<span>点赞</span>
                            	<span class="blog_bom_word">${lis.addlikeCount }</span>
                            </span>
                            <c:if test="${sequence==2 || lis.sequence==sequence}">
                            	<span>
									<input type='button' value='编辑' name='updateMessage' class='btn btn-info' onclick="update(${lis.newmessage_id})" >
									<input type='button'  value='删除' name='deleteMessage' class='btn btn-danger' onclick="deletes(${lis.newmessage_id})" >
								</span>
							</c:if>
                        </div>
                    </div>
                </div>
                
                  	</c:forEach>
			</c:when>
		</c:choose>
                
            </div>
		  		
		  		</div>
		  	</div>
			
	 		
          
        
		
	<c:choose>
		<c:when test="${not empty page }">
		  <!-- 分页功能 start -->
		<div align="center">
			<font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
				${page.pageNow} 页</font> <a href="/TeaCulture/newmessagelist?pageNow=1">首页</a>
			<c:choose>
				<c:when test="${page.pageNow - 1 > 0}">
					<a href="/TeaCulture/newmessagelist?pageNow=${page.pageNow - 1}">上一页</a>
				</c:when>
				<c:when test="${page.pageNow - 1 <= 0}">
					<a href="/TeaCulture/newmessagelist?pageNow=1">上一页</a>
				</c:when>
			</c:choose>
			<c:choose>
				<c:when test="${page.totalPageCount==0}">
					<a href="/TeaCulture/newmessagelist?pageNow=${page.pageNow}">下一页</a>
				</c:when>
				<c:when test="${page.pageNow + 1 < page.totalPageCount}">
					<a href="/TeaCulture/newmessagelist?pageNow=${page.pageNow + 1}">下一页</a>
				</c:when>
				<c:when test="${page.pageNow + 1 >= page.totalPageCount}">
					<a href="/TeaCulture/newmessagelist?pageNow=${page.totalPageCount}">下一页</a>
				</c:when>
			</c:choose>
			<c:choose>
				<c:when test="${page.totalPageCount==0}">
					<a href="/TeaCulture/newmessagelist?pageNow=${page.pageNow}">尾页</a>
				</c:when>
				<c:otherwise>
					<a href="/TeaCulture/fnewmessagelist?pageNow=${page.totalPageCount}">尾页</a>
				</c:otherwise>
			</c:choose>
		</div>
		</c:when>
	</c:choose>
	</div>
</div>
</body>
</html>
